全部文档

7.6Bluetooth和Zigbee命令管理

命令下发会指定某台Bluetooth或ZigBee设备,并对此设备的指定属性进行异步读写。

7.6.1Bluetooth或Zigbee设备通过deviceId异步下发读取/写入命令

功能描述:Bluetooth或Zigbee设备异步下发命令读取/写入功能点属性信息

POST /api/v1/commands-async/lightweight

Body:

Name Type Description Required
deviceId int 设备ID Yes
functionType string 命令类型,可选值propertyGet/propertySet Yes
identifier string 属性名 Yes
identifierValue object 属性值,functionType值为propertySet时必需 No

Body example:

{
    "deviceId":10086,
    "functionType": "propertySet",
    "identifier": "身高",
    "identifierValue": "180"
}
当功能属性类型为Bytes时,identifierValue由多个16进制字符和空格组成,空格无实际意义,例如:
"identifierValue": "13 0F 03"

cURL example:

curl --location --request POST '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/commands-async/mqtt?accessKeyId={accessKeyId}&signatureNonce=495&signature={signature}' \
--header 'platform: 1' \
--header 'projectId: {projectId}' \
--header 'Content-Type: application/json' \
--data-raw '{
                "deviceId":10086,
                "functionType": "propertySet",
                "identifier": "身高",
                "identifierValue": "180"
            }'

Response data:

Name Type Description
commandId String 命令ID

Response

{
    "code":0,
    "message":"",
    "data":{
        "commandId": "02e86b96-a484-4e4e-9282-84b804f68fd5"
    }
}

7.6.2Bluetooth或Zigbee设备通过productId + deviceName异步下发读取/写入命令

功能描述:Bluetooth或Zigbee设备异步下发命令读取/写入功能点属性信息

POST /api/v1/device/command/byname/async

Body:

Name Type Description Required
productId int 产品ID Yes
deviceName string 设备名称 Yes
functionType string 命令类型,可选值propertyGet/propertySet Yes
identifier string 属性名 Yes
identifierValue object 属性值,functionType值为propertySet时必需 No

Body example:

{
    "productId":10086,
    "deviceName": "test",
    "functionType": "propertySet",
    "identifier": "身高",
    "identifierValue": "180"
}
当功能属性类型为Bytes时,identifierValue由多个16进制字符和空格组成,空格无实际意义,例如:
"identifierValue": "13 0F 03"

cURL example:

curl --location --request POST '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/device/command/byname/async?accessKeyId={accessKeyId}&signatureNonce=495&signature={signature}' \
--header 'platform: 1' \
--header 'projectId: {projectId}' \
--header 'Content-Type: application/json' \
--data-raw '{
                "productId":10086,
                "deviceName": "test",
                "functionType": "propertySet",
                "identifier": "身高",
                "identifierValue": "180"
            }'

Response data:

Name Type Description
commandId String 命令ID

Response

{
    "code":0,
    "message":"",
    "data":{
        "commandId": "02e86b96-a484-4e4e-9282-84b804f68fd5"
    }
}

7.6.3分组批量下发Bluetooth或Zigbee异步命令

功能描述:提供对指定组下的Bluetooth或Zigbee设备的读,写命令的下发功能,返回命令执行的结果。

POST  /api/v1/command/multi/lightweight

Body:

Name Type Description Required
groupId int 组ID Yes
functionType string 命令类型,可选值propertyGet/propertySet Yes
identifier string 属性名 Yes
identifierValue object 属性值,functionType值为propertySet时必需,值类型:String/Integer/Long/Float/Double/Boolean/Date/Bytes No

Body example:

{
    "groupId": 674,
    "functionType": "propertySet",
    "identifier": "tempratrue",
    "identifierValue": 30
}
当功能属性类型为Bytes时,identifierValue由多个16进制字符和空格组成,空格无实际意义,例如:
"identifierValue": "13 0F 03"

cURL example:

curl --location --request POST '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/command/multi/mqtt?accessKeyId={accessKeyId}&signatureNonce=495&signature={signature}' \
--header 'platform: 1' \
--header 'projectId: {projectId}' \
--header 'Content-Type: application/json' \
--data-raw '{
                "groupId": 674,
                "functionType": "propertySet",
                "identifier": "tempratrue",
                "identifierValue": 30
            }'

Response data:

Name Type Description
batchId String 批次ID

Response example:

{
    "success": true,
    "code": 0,
    "msg": "",
    "data": {
        "batchId":"xxxx"
    }
}

results matching ""

    No results matching ""